<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/comet4j.js"></script>
<script type="text/javascript">
	$(function CometEx() {
		 var number1 = document.getElementById('number1');
		          var number2 = document.getElementById('number2');
		          // 建立连接，conn 即web.xml中 CometServlet的<url-pattern>
		          JS.Engine.start('conn');
		          // 监听后台某个频道
		          JS.Engine.on(
		                 { 
		                     // 对应服务端 “频道1” 的值 result1
		                     result1 : function(num1){
		                         number1.innerHTML = num1;
		                  },
		                  // 对应服务端 “频道2” 的值 result2
		                  result2 : function(num2){
		                         number2.innerHTML = num2;
		                  },
		              }
		             );
	});
	function zero(){
		$.post('comet/zero',{id:$("#id").val()});
	}
</script>
</head>

<body>
	This is my JSP page.1231234
	<br> ${message}
	    数字1：<span id="number1">...</span><br></br>
         数字2：<span id="number2">...</span>
         <input id="id" type="text"/>
         <button id='zero' onclick="zero()">发送</button>
</body>
</html>
